Part Number Hot Search : 
1344171 67F110 18X40 4002BH A52101 5EK7M E1482S PL43Z
Product Description
Full Text Search
 

To Download AT89C51CC0303 Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
 Features
* Protocol
- CAN Used as Physical Layer - 7 ISP CAN Identifiers - Relocatable ISP CAN Identifiers - Autobaud * In-System Programming - Read/Write Flash and EEPROM Memories - Read Device ID - Full-chip Erase - Read/Write Configuration Bytes - Security Setting From ISP Command - Remote Application Start Command * In-Application Programming/Self Programming - Read/Write Flash and EEPROM Memories - Read Device ID - Block Erase - Read/Write Configuration Bytes - Bootloader Start
CAN Microcontrollers
AT89C51CC03 CAN Bootloader
Description
This document describes the CAN bootloader functionalities as well as the CAN protocol to efficiently perform operations on the on-chip Flash (EEPROM) memories. Additional information on the AT89C51CC03 product can be found in the AT89C51CC03 datasheet and the AT89C51CC03 errata sheet available on the Atmel web site. The bootloader software package (source code and binary) currently used for production is available from the Atmel web site.
Bootloader Revision Revisions 1.0.0 and higher
Purpose of Modifications First release
Date 01/08/2003
Rev. 4251A-CAN-08/03
1
Functional Description
In-System Programming Capability
The AT89C51CC03 Bootloader facilitates In-System Programming and In-Application Programming. In-System Programming allows the user to program or reprogram a microcontroller onchip Flash memory without removing it from the system and without the need of a preprogrammed application. The CAN bootloader can manage a communication with a host through the CAN network. It can also access and perform requested operations on the on-chip Flash Memory.
In-Application Programming or Self Programming Capability
In-Application Programming (IAP) allows the reprogramming of a microcontroller onchip Flash memory without removing it from the system and while the embedded application is running. The CAN bootloader contains some Application Programming Interface routines named API routines allowing IAP by using the user's firmware.
Block Diagram
This section describes the different parts of the bootloader. The figure below shows the on-chip bootloader and IAP processes. Figure 1. Bootloader Process Description
On Chip User Application
External host via the CAN Protocol Communication
ISP Communication Management
IAP User Call Management
Flash Memory Management
Flash Memory
2
AT89C51CC03 CAN Bootloader
4251A-CAN-08/03
AT89C51CC03 CAN Bootloader
ISP Communication Management The purpose of this process is to manage the communication and its protocol between the on-chip bootloader and an external device (host). The on-chip bootloader implements a CAN protocol (see Section "Protocol"). This process translates serial communication frames (CAN) into Flash memory accesses (read, write, erase...). Several Application Program Interface (API) calls are available to the application program to selectively erase and program Flash pages. All calls are made through a common interface (API calls) included in the bootloader. The purpose of this process is to translate the application request into internal Flash Memory operations. This process manages low level accesses to the Flash memory (performs read and write accesses).
User Call Management
Flash Memory Management
Bootloader Configuration
Configuration and Manufacturer Information The table below lists Configuration and Manufacturer byte information used by the bootloader. This information can be accessed through a set of API or ISP commands.
Mnemonic BSB SBV SSB EB CANBT1 CANBT2 CANBT3 NNB CRIS Manufacturer Id1: Family code Id2: Product Name Id3: Product Revision Description Boot Status Byte Software Boot Vector Software Security Byte Extra Byte CAN Bit Timing 1 CAN Bit Timing 2 CAN Bit Timing 3 Node Number Byte CAN Re-locatable Identifier Segment Default Value FFh FCh FFh FFh FFh FFh FFh FFh FFh 58h D7h FFh FEh
3
4251A-CAN-08/03
Mapping and Default Value of Hardware Security Byte
The 4 MSB of the Hardware Byte can be read/written by software (this area is called Fuse bits). The 4 LSB can only be read by software and written by hardware in parallel mode (with parallel programmer devices).
Bit Position 7 6 5 4 3 2 1 0 Mnemonic X2B BLJB reserved reserved reserved LB2 LB1 LB0 Default Value U P U U U P U U To lock the chip (see datasheet) Description To start in x1 mode To map the boot area in code area between F800h-FFFFh
Note:
U: Unprogram = 1 P: Program = 0
Security
The bootloader has Software Security Byte (SSB) to protect itself from user access or ISP access. The Software Security Byte (SSB) protects from ISP accesses. The command "Program Software Security Bit" can only write a higher priority level. There are three levels of security: * Level 0: NO_SECURITY (FFh) This is the default level. From level 0, one can write level 1 or level 2. Level 1: WRITE_SECURITY (FEh) In this level it is impossible to write in the Flash memory, BSB and SBV. The Bootloader returns ID_ERROR message. From level 1, one can write only level 2. Level 2: RD_WR_SECURITY (FCh) Level 2 forbids all read and write accesses to/from the Flash memory. The Bootloader returns ID_ERROR message.
*
*
Only a full chip erase command can reset the software security bits.
Level 0 Flash/EEPROM Fuse bit BSB & SBV & EB SSB Manufacturer info Bootloader info Erase block Full chip erase Blank Check Any access allowed Any access allowed Any access allowed Any access allowed Read only access allowed Read only access allowed Allowed Allowed Allowed Level 1 Read only access allowed Read only access allowed Read only access allowed Write level2 allowed Read only access allowed Read only access allowed Not allowed Allowed Allowed Level 2 All access not allowed All access not allowed All access not allowed Read only access allowed Read only access allowed Read only access allowed Not allowed Allowed Allowed
4
AT89C51CC03 CAN Bootloader
4251A-CAN-08/03
AT89C51CC03 CAN Bootloader
Software Boot Vector
The Software Boot Vector (SBV) forces the execution of a user bootloader starting at address [SBV]00h in the application area (FM0). The way to start this user bootloader is described in Section "Boot Process".
CAN Bootloader User Bootloader Application [SBV]00h
FM1
FM0
FLIP Software Program
FLIP is a PC software program running under Windows 9x / NT / 2K / XP and LINUX that supports all Atmel Flash microcontroller and CAN protocol communication media. Several CAN dongles are supported by FLIP (for Windows). This free software program is available from the Atmel web site.
5
4251A-CAN-08/03
In-System Programming
ISP allows the user to program or reprogram a microcontroller's on-chip Flash memory through the CAN network without removing it from the system and without the need of a pre-programmed application. This section describes how to start the CAN bootloader and the higher level protocol over the CAN.
Boot Process
The bootloader can be activated in two ways: * * Hardware conditions Regular boot process
Hardware Conditions
The Hardware conditions (EA = 1, PSEN = 0) during the RESET# falling edge force the on-chip bootloader execution. In this way the bootloader can be carried out whatever the user Flash memory content. As PSEN is an output port in normal operating mode (running user application or bootloader code) after reset, it is recommended to release PSEN after falling edge of reset signal. The hardware conditions are sampled at reset signal falling edge, thus they can be released at any time when reset input is low.
6
AT89C51CC03 CAN Bootloader
4251A-CAN-08/03
AT89C51CC03 CAN Bootloader
Regular Boot Process
RESET bit E N B O O T in A U XR 1 R egister is initialized w ith B LJ B inverted ENBOOT = 1 P C = F 800h F C O N = 00h
Hardware Boot Process
H ardw are C ondition No ENBO OT = 0 P C = 0000h
Y es
Y es
B LJB = 1 ENBOOT = 1 P C = F 800h F C O N = 0F h
No
Software Boot Process
F C O N = 00h
Y es
No
S B V < F 8h
No
Y es
S ta rt A pp lica tio n
S tart U se r B o o tlo a d e r
S ta rt B o o tlo a d e r
7
4251A-CAN-08/03
Physical Layer
The CAN is used to transmit information has the following configuration: * * * Standard Frame CAN format 2.0A (identifier 11-bit) Frame: Data Frame Baud rate: autobaud is performed by the bootloader
CAN Controller Initialization
Two ways are possible to initialize the CAN controller: * * * * Use the software autobaud Use the user configuration stored in the CANBT1, CANBT2 and CANBT3 EB = FFh: the autobaud is performed. EB not equal to FFh: the CANBT1:2:3 are used.
The selection between these two solutions is made with EB:
CANBT1:3 and EB can be modified by user through a set of API or with ISP commands. The figure below describes the CAN controller flow. Figure 2. CAN Controller Initialization
CAN controller Initialization
EB = FFh
Yes
No Read CANBT1 value Read CANBT2 value Read CANBT3 value
CANBTx = FFh x=(1,3) No Configure the CAN controller
Yes
CAN Error
Yes Set the CAN controller in autobaud mode
No
Autobaud ok Yes
No
CAN macro Initialized
8
AT89C51CC03 CAN Bootloader
4251A-CAN-08/03
AT89C51CC03 CAN Bootloader
CAN Autobaud The table below shows the autobaud performance for a point to point connection in X1 mode.
8 MHz 20 k 100 k 125 k 250 k 500 k 1M 11.059 MHz 12 MHz 16 MHz 20 MHz 22.1184 24 MHz 25 MHz 32 MHz 40 MHz MHz
- -
-
-
-
Note:
`-' indicates an impossible configuration.
CAN Autobaud Limitation
The CAN autobaud implemented in the bootloader is efficient only in point-to-point connection. Because in a point to point connection, the transmit CAN message is repeated until a hardware acknowledge is done by the receiver. The bootloader can acknowledge an in-coming CAN frame only if a configuration is found. This functionality is not guaranteed on a network with several CAN nodes.
9
4251A-CAN-08/03
Protocol
Generic CAN Frame Description Identifier 11-bit * * * Control 1 byte Data 8 bytes max
Identifier: Identifier identifies the frame (or message). Only the standard mode (11-bit) is used. Control: Control contains the DLC information (number of data in Data field) 4-bit. Data: Data field consists of zero to eight bytes. The interpretation within the frame depends on the Identifier field.
To describe the ISP CAN Protocol, we use Symbolic name for Identifier, but default values are given.
The CAN protocol manages directly using hardware a checksum and an acknowledge.
Note:
Command Description
This protocol allows to: * * * * * * * Initiate the communication Program the Flash or EEPROM Data Read the Flash or EEPROM Data Program Configuration Information Read Configuration and Manufacturer Information Erase the Flash Start the application
Overview of the protocol is detailed in APPENDIX-1. Several CAN message identifiers are defined to manage this protocol.
Identifier ID_SELECT_NODE ID_PROG_START ID_PROG_DATA ID_DISPLAY_DATA ID_WRITE_COMMAND ID_READ_COMMAND ID_ERROR Command Effect Open/Close a communication with a node Start a Flash/EEPROM programming Data for Flash/EEPROM programming Display data Write in XAF, or Hardware Byte Read from XAF or Hardware Byte and special data Error message from bootloader only Value [CRIS]0h [CRIS]1h [CRIS]2h [CRIS]3h [CRIS]4h [CRIS]5h [CRIS]6h
It is possible to allocate a new value for CAN ISP identifiers by writing the byte CRIS with the base value for the group of identifier. The maximum value for CRIS is 7Fh and the default CRIS value is 00h.
10
AT89C51CC03 CAN Bootloader
4251A-CAN-08/03
AT89C51CC03 CAN Bootloader
Figure 3. Identifier Remapping CAN Identifiers
7FFh
CAN ISP identifiers
ID_error ID_read_command ID_write_command ID_display_data ID_prog_data ID_prog_start ID_select_node [CRIS]0h
Group of 7CAN messages Used to manage CAN ISP
000h
Communication Initialization
The communication with a device (CAN node) must be opened prior to initiate any ISP communication. To open communication with the device, the Host sends a "connecting" CAN message (Id_select_node) with the node number (NNB) passed in parameter. If the node number passed is equal to FFh then the CAN bootloader accepts the communication (Figure 4). Otherwise the node number passed in parameter must be equal to the local Node Number (Figure 5).
Figure 4. First Connection
Interface board between PC NNB = FFh (default value) and CAN network Host Node 1
Figure 5. On Network Connection
NNB = 00h Node 0 Interface board between PC and CAN network Host NNB = 01h Node 1 NNB = 03h Node 3 NNB = n Node n
Before opening a new communication with another device, the current device communication must be closed with its connecting CAN message (Id_select_node).
11
4251A-CAN-08/03
Request From Host
Identifier ID_SELECT_NODE Length 1 data[0] num_node
Note:
num_node is the NNB (Node Number Byte) to which the Host wants to talk to.T
Answers From Bootloader
Identifier ID_SELECT_NODE Length 2 data[0] boot_version 01h Communication open data[1] 00h Comment Communication close
Note:
data[0] contains the bootloader version.
If the communication is closed then all the others messages won't be managed by bootloader.
Flow Description Host
Send Select Node message with node number in parameter
Bootloader
Id_select_node message
Wait Select Node
OR
node select = FFh node select = local node number
Time-out 10 ms COMMAND ABORTED
state com = com open
State com = com open State com = com closed
Read Bootloader Version Wait Select Node COMMAND FINISHED
Id_select_node message
Send Bootloader Version and state of communication
COMMAND FINISHED
Example
identifier HOST BOOTLOADER Id_select_node Id_select_node length 01 02 data FF 01 01
12
AT89C51CC03 CAN Bootloader
4251A-CAN-08/03
AT89C51CC03 CAN Bootloader
Programming the Flash or EEPROM Data The flow described below shows how to program data in the Flash memory or in the EEPROM data memory. This operation can be executed only with a device previously opened in communication. 1. The first step is to indicate which memory area (Flash or EEPROM data) is selected and the range address to program. 2. The second step is to transmit the data. The bootloader programs on a page of 128 bytes basis when it is possible. The host must take care that: * * The data to program transmitted within a CAN frame are in the same page. To transmit 8 data bytes in CAN message when it is possible
3. To start the programming operation, the Host sends a "start programming" CAN message (Id_prog_start) with the area memory selected in data[0], the start address and the end address passed in parameter. Requests From Host
Identifier ID_PROG_START Length 5 01h data[0] 00h address_start address_end data[1] data[2] data[3] data[4]
Note:
1. Data[0] chooses the area to program: - 00h: Flash - 01h: EEPROM data 2. Address_start gives the start address of the programming command. 3. Address_end gives the last address of the programming command.
Answers From Bootloader
The device has two possible answers: * * If the chip is protected from program access an "Error" CAN message is sent (see Section "Error Message Description"). Otherwise an acknowledge is sent.
Identifier ID_PROG_START Length 0
The second step of the programming operation is to send data to program. Request From Host To send data to program, the Host sends a "programming data" CAN message (Id_prog_data) with up to 8 data by message and must wait for the answer of the device before sending the next data to program.
Identifier ID_PROG_DATA Length up to 8 data[0] x ... ... data[7] x
Answers From Bootloader
The device has two possible answers: * If the device is ready to receive new data, it sends a "programming data" CAN message (Id_prog_data) with the result Command_new passed in parameter.
13
4251A-CAN-08/03
*
If the device has finished the programming, it sends a "programming data" CAN message (Id_prog_data) with the result Command_ok passed in parameter.
Identifier Length data[0] 00h ID_PROG_DATA 1 01h 02h Description Command ok Command fail Command new data
Flow Description Host
Send prog_start message with addresses
Bootloader
Id_prog_start message
Wait Prog start
OR Wait ERROR COMMAND ABORTED Wait ProgStart
SSB = Level 0
Id_error message Id_prog_start message
Send ERROR
Send ProgStart
Send prog_data message with 8 datas
Id_prog_data message
Wait Data prog
Column Latch Full
All bytes received
Wait Programming
All bytes received
OR Wait COMMAND_N
Id_prog_data message
Send COMMAND_NEW_DATA
Id_prog_data message
Wait COMMAND_OK COMMAND FINISHED
Send COMMAND_OK
COMMAND FINISHED
14
AT89C51CC03 CAN Bootloader
4251A-CAN-08/03
AT89C51CC03 CAN Bootloader
Example Programming Data (write 55h from 0000h to 0008h in the flash)
identifier HOST BOOTLOADER HOST BOOTLOADER HOST BOOTLOADER Id_prog_start Id_prog_start Id_prog_data Id_prog_data Id_prog_data Id_prog_data control 05 00 08 01 01 01 00 data 00 00 00 08
55 55 55 55 55 55 55 55 // command_new_data 02 55 // command_ok 00
Programming Data (write 55h from 0000h to 0008h in the flash), w
identifier HOST BOOTLOADER Id_prog_start Id_error control 04 01 data 00 00 00 08 00 // error_security
Reading the Flash or EEPROM Data
The flow described below allows the user to read data in the Flash memory or in the EEPROM data memory. A blank check command on the Flash memory is possible with this flow. This operation can be executed only with a device previously opened in communication. To start the reading operation, the Host sends a "Display Data" CAN message (Id_display_data) with the area memory selected, the start address and the end address passed in parameter. The device splits into block of 8 bytes data to transfer to the Host if the number of data to display is greater than 8 data bytes.
Requests from Host
Identifier Length data[0] 00h ID_DISPLAY_DATA 5 01h 02h address_start address_end data[1] data[2] data[3] data[4]
Note:
1. Data[0] selects the area to read and the operation - 00h: Display Flash - 01h: Blank Check on the Flash - 02h: Display EEPROM data 2. The address_start gives the start address to read. 3. The address_end gives the last address to read.
Answers from Bootloader
The device has two possible answers: * * If the chip is protected from read access a "Error" CAN message is sent (see Section "Error Message Description"). Otherwise: for a display command the device start to send the data up to 8 by frame to the host. for a blank check command the device send a result ok or the first address not erased.
15
4251A-CAN-08/03
Answer to a read command:
Identifier ID_DISPLAY_DATA Length n data[n] x
Answer to a blank check command:
Identifier ID_DISPLAY_DATA 2 address_start Length 0 data[0] data[1] Description Blank Check OK
Flow Description Host
Send display_data message with addresses or blank check
Bootloader
Id_display_data message
Wait Display Data
OR Wait ERROR COMMAND ABORTED
SSB = Level2
Id_error message
Send ERROR
Blank command
Read Data
All data read
nb max by frame
OR Wait Data Display
Id_display_data message
Send DATA Read
Verify memory
All data read All data read
COMMAND FINISHED
COMMAND FINISHED
Blank Check
OR Wait COMMAND_KO COMMAND FINISHED Wait COMMAND_OK COMMAND FINISHED
Id_display_data message Id_display_data message
Send COMMAND_KO
Send COMMAND_OK
16
AT89C51CC03 CAN Bootloader
4251A-CAN-08/03
AT89C51CC03 CAN Bootloader
Example Display Data (from 0000h to 0008h)
identifier HOST BOOTLOADER BOOTLOADER Id_display_data Id_display_data Id_display_data control 05 08 01 data 00 00 55 55 55 00 00 08 55 55 55 55
55
55
Blank Check
identifier HOST BOOTLOADER Id_display_data Id_display_data control 05 00 data 01 00 00 00 08 // Command ok
Programming Configuration Information
The flow described below allows the user to program Configuration Information regarding the bootloader functionality. This operation can be executed only with a device previously opened in communication. The Configuration Information can be divided in two groups: * Boot Process Configuration: BSB SBV Fuse bits (BLJB and X2 bits) (see Section "Mapping and Default Value of Hardware Security Byte") CAN Protocol Configuration: BTC_1, BTC_2, BTC_3 SSB EB NNB CRIS
The CAN protocol configuration bytes are taken into account only after the next reset.
*
Note:
To start the programming operation, the Host sends a "write" CAN message (Id_write_command) with the area selected, the value passed in parameter. Take care that the Program Fuse bit command programs the 4 Fuse bits at the same time.
17
4251A-CAN-08/03
Requests From Host
Identifier Length data[0] data[1] 00h 01h 05h 06h 3 ID_WRITE_COMMAND 1Dh 1Eh 1Fh 20h 2 02h value write value in BTC_2 write value in BTC_3 write value in NNB write value in CRIS write value in Fuse bits 01h 1Ch value data[2] Description write value in BSB write value in SBV write value in SSB write value in EB write value in BTC_1
Answers From Bootloader
The device has two possible answers: * * If the chip is protected from program access a "Error" CAN message is sent (see Section "Error Message Description"). Otherwise an acknowledge "Command ok" is sent.
Identifier ID_WRITE_COMMAND
Length 1
data[0] 00h
Description Command ok
Flow Description Host
Send Write_Command
Bootloader
Id_write_com message
Wait Write_Command
OR Wait ERROR_SECURITY COMMAND ABORTED
NO_SECURITY
Id_error message
Send ERROR_SECURITY
Write Data
Wait COMMAND_OK COMMAND FINISHED
Id_write_com message
Send COMMAND_OK
COMMAND FINISHED
18
AT89C51CC03 CAN Bootloader
4251A-CAN-08/03
AT89C51CC03 CAN Bootloader
Example
Write BSB at 88h
identifier HOST BOOTLOADER Id_write_command Id_write_command control 03 01 data 01 00 00 88
// command_ok
Write Fuse bit at Fxh
identifier HOST BOOTLOADER Id_write_command Id_write_command control 02 01 02 00 data F0 // command_ok
Reading Configuration Information or Manufacturer Information
The flow described below allows the user to read the configuration or manufacturer information. This operation can be executed only with a device previously opened in communication. To start the reading operation, the Host sends a "Read command" CAN message (Id_read_command) with the information selected passed in data field.
Requests From Host
Identifier Length data[0] data[1] 00h 2 00h 01h 02h 00h 01h 05h 06h 1Ch ID_READ_COMMAND 2 01h 1Dh 1Eh 1Fh 20h 30h 31h 60h 61h 2 02h 00h Description Read Bootloader version Read Device ID1 Read Device ID2 Read BSB Read SBV Read SSB Read EB Read BTC_1 Read BTC_2 Read BTC_3 Read NNB Read CRIS Read Manufacturer Code Read Family Code Read Product Name Read Product Revision Read HSB (Fuse bits)
19
4251A-CAN-08/03
Answers From Bootloader
The device has two possible answers: * * If the chip is protected from read access an "Error" CAN message is sent (see Section "Error Message Description"). Otherwise: the device answers with a Read Answer CAN message (Id_read_command).
Identifier ID_READ_COMMAND Length 1 data[n] value
Flow Description Host
Send read_com message
Bootloader
Id_read_com message
Wait Read_Com
OR Wait ERROR_SECURITY COMMAND ABORTED
RD_WR_SECURITY
Id_error message
Send ERROR_SECURITY
Read Data
Wait Value of data COMMAND FINISHED
Id_read_com message
Send Data read
COMMAND FINISHED
Example Read Bootloader Version
identifier HOST BOOTLOADER Id_read_command Id_read_command control 02 01 data 00 55 00 // Bootloader version 55h
Read SBV
identifier HOST BOOTLOADER Id_read_command Id_read_command control 02 01 01 F5 data 01 // SBV = F5h
Read Fuse bit
identifier HOST BOOTLOADER Id_read_command Id_read_command control 01 01 02 F0 // Fuse bit = F0h data
20
AT89C51CC03 CAN Bootloader
4251A-CAN-08/03
AT89C51CC03 CAN Bootloader
Erasing the Flash The flow described below allows the user to erase the Flash memory. This operation can be executed only with a device previously opened in communication. Two modes of Flash erasing are possible: * * Full Chip erase Block erase
The Full Chip erase command erases the whole Flash (64 Kbytes) and sets some Configuration Bytes at their default values: * * * BSB = FFh SBV = FFh SSB = FFh (NO_SECURITY)
The Block erase command erases only a part of the Flash. Three Blocks are defined in the AT89C51CC03: * * * * * * To start the erasing operation, the Host sends a "write" CAN message (Id_write_command). Requests From Host
Identifier Length data[0] data[1] 00h 20h 40h ID_WRITE_COMMAND 2 00h 80h C0h FFh Erase block3 (32k to 48k) Erase block4 (48k to 64k) Full chip erase Description Erase block0 (0k to 8k) Erase block1 (8k to 16k) Erase block2 (16k to 32k)
block0 (From 0000h to 1FFFh) block1 (From 2000h to 3FFFh) block2 (From 4000h to 7FFFh) block3 (From 8000h to BFFFh) block4 (From C000h to FFFFh)
Answers From Bootloader
As the Program Configuration Information flows, the erase block command has two possible answers: * * If the chip is protected from program access an "Error" CAN message is sent (see Section "Error Message Description"). Otherwise an acknowledge is sent.
The full chip erase is always executed whatever the Software Security Byte value is. On a full chip erase command an acknowledge "command ok" is sent.
Identifier ID_WRITE_COMMAND Length 1 data[0] 00h Description Command ok
21
4251A-CAN-08/03
Example Full Chip Erase
identifier HOST BOOTLOADER Id_write_command Id_write_command control 02 01 data 00 00 FF // command_ok
Starting the Application
The flow described below allows to start the application directly from the bootloader upon a specific command reception. This operation can be executed only with a device previously opened in communication. Two options are possible: * Start the application with a reset pulse generation (using watchdog). When the device receives this command the watchdog is enabled and the bootloader enters a waiting loop until the watchdog resets the device. Take care that if an external reset chip is used the reset pulse in output may be wrong and in this case the reset sequence is not correctly executed. Start the application without reset A jump at the address 0000h is used to start the application without reset.
*
To start the application, the Host sends a "start application" CAN message (Id_write_command) with the corresponding option passed in parameter. Requests From Host
Identifier Length 2 ID_WRITE_COMMAND 4 03h 01h address Start Application with a jump at "address" data[0] data[1] 00h data[2] data[3] Description Start Application with a reset pulse generation
Answer From Bootloader Example
No answer is returned by the device.
Start application
identifier HOST BOOTLOADER Id_write_command No answer control 04 data 03 01 00 00
Error Message Description
The error message is implemented to report when an action required is not possible. * At the moment only the security error is implemented and only the device can answer this kind of CAN message (Id_error).
Identifier ID_ERROR Length 1 data[0] 00h Description Software Security Error
22
AT89C51CC03 CAN Bootloader
4251A-CAN-08/03
AT89C51CC03 CAN Bootloader
In-Application Programming/Self Programming
The IAP allows to reprogram a microcontroller on-chip Flash memory without removing it from the system and while the embedded application is running. The user application can call Application Programming Interface (API) routines allowing IAP. These API are executed by the bootloader. To call the corresponding API, the user must use a set of Flash_api routines which can be linked with the application. Example of Flash_api routines are available on the Atmel web site on the software package: C Flash Drivers for the AT89C51CC03CA for Keil Compilers The flash_api routines on the package work only with the CAN bootloader. The flash_api routines are listed in APPENDIX-2.
API Call
Process The application selects an API by setting the 4 variables available when the flash_api library is linked to the application. These four variables are located in RAM at fixed address: * * * * api_command: 1Ch api_value: 1Dh api_dph: 1Eh api_dpl: 1Fh
All calls are made through a common interface "USER_CALL" at the address FFF0h. The jump at the USER_CALL must be done by LCALL instruction to be able to comeback in the application. Before jump at the USER_CALL, the bit ENBOOT in AUXR1 register must be set. Constraints The interrupts are not disabled by the bootloader. Interrupts must be disabled by user prior to jump to the USER_CALL, then re-enabled when returning. Interrupts must also be disabled before accessing EEPROM Data then re-enabled after. The user must take care of hardware watchdog before launching a Flash operation. For more information regarding the Flash writing time see the AT89C51CC03 datasheet.
23
4251A-CAN-08/03
API Commands
Several types of APIs are available: * * * * * Read/Program Flash and EEPROM Data memory Read Configuration and Manufacturer Information Program Configuration Information Erase Flash Start bootloader
Read/Program Flash and EEPROM Data Memory
All routines to access EEPROM Data are managed directly from the application without using bootloader resources. To read the Flash memory the bootloader is not involved. For more details on these routines see the AT89C51CC03 Datasheet sections "Program/Code Memory" and "EEPROM Data Memory" Two routines are available to program the Flash: - - * __api_wr_code_byte __api_wr_code_page
The application program load the column latches of the Flash then call the __api_wr_code_byte or __api_wr_code_page see datasheet in section "Program/Code Memory". Parameter settings
api_command 0Dh api_dph api_dpl api_value -
*
API Name __api_wr_code_byte __api_wr_code_page
*
instruction: LCALL FFF0h.
No special resources are used by the bootloader during this operation
Note:
Read Configuration and Manufacturer Information
*
Parameter settings
api_command 08h 05h 05h 05h 05h 05h 05h 05h 05h 05h 05h 05h api_dph api_dpl 00h 00h 01h 05h 06h 1Ch 1Dh 1Eh 1Fh 20h 30h 31h api_value return HSB return BSB return SBV return SSB return EB return CANBTC1 return CANBTC2 return CANBTC3 return NNB return CRIS return manufacturer id return id1
API Name __api_rd_HSB __api_rd_BSB __api_rd_SBV __api_rd_SSB __api_rd_EB __api_rd_CANBTC1 __api_rd_CANBTC2 __api_rd_CANBTC3 __api_rd_NNB __api_rd_CRIS __api_rd_manufacturer __api_rd_device_id1
24
AT89C51CC03 CAN Bootloader
4251A-CAN-08/03
AT89C51CC03 CAN Bootloader
API Name __api_rd_device_id2 __api_rd_device_id3 __api_rd_bootloader_version api_command 05h 05h 0Eh api_dph api_dpl 60h 61h 00h api_value return id2 return id3 return value
* *
Instruction: LCALL FFF0h. At the complete API execution by the bootloader, the value to read is in the api_value variable.
No special resources are used by the bootloader during this operation
Note:
Program Configuration Information
*
Parameter settings
api_command 07h 07h 07h 07h 04h 04h 04h 04h 04h 04h 04h 04h 04h api_dph api_dpl 00h 01h 05h 06h 1Ch 1Dh 1Eh 1Fh 20h api_value (HSB & BFh) | 40h HSB & BFh (HSB & 7Fh) | 80h HSB & 7Fh value to write value to write value to write value to write value to write value to write value to write value to write value to write
API Name __api_clr_BLJB __api_set_BLJB __api_clr_X2 __api_set_X2 __api_wr_BSB __api_wr_SBV __api_wr_SSB __api_wr_EB __api_wr_CANBTC1 __api_wr_CANBTC2 __api_wr_CANBTC3 __api_wr_NNB __api_wr_CRIS
*
instruction: LCALL FFF0h.
1. See in the AT89C51CC03 datasheet the time that a write operation takes. 2. No special resources are used by the bootloader during these operations
Note:
Erasing the Flash
The AT89C51CC03 Flash memory is divided in several blocks: Block 0: from address 0000h to 1FFFh Block 1: from address 2000h to 3FFFh Block 2: from address 4000h to 7FFFh Block 3: from address 8000h to BFFFh Block 4: from address C000h to FFFFh These five blocks contain 256 pages.
25
4251A-CAN-08/03
*
Parameter settings
api_command 00h 00h 00h 00h 00h api_dph 00h 20h 40h 80h C0h api_dpl api_value -
API Name __api_erase_block0 __api_erase_block1 __api_erase_block2 __api_erase_block3 __api_erase_block4
*
instruction: LCALL FFF0h.
1. See the AT89C51CC03 datasheet for the time that a write operation takes and this time must multiply by the number of pages. 2. No special resources are used by the bootloader during these operations
Note:
Starting the Bootloader
There are two start bootloader routines possible: This routine allows to start at the beginning of the bootloader as after a reset. After calling this routine the regular boot process is performed and the communication must be opened before any action. * * * No special parameter setting Set bit ENBOOT in AUXR1 register instruction: LJUMP or LCALL at address F800h
This routine allows to start the bootloader with the CAN bit configuration of the application and start with the state "communication open". That means the bootloader will return the message "id_select_node" with the field com port open. * * * No special parameter setting Set bit ENBOOT in AUXR1 register instruction: LJUMP or LCALL at address FF00h
26
AT89C51CC03 CAN Bootloader
4251A-CAN-08/03
AT89C51CC03 CAN Bootloader
Appendix-1
Table 1. Summary of Frames from Host
Identifier Id_select_node (CRIS:0h) Id_prog_start (CRIS:1h) Id_prog_data (CRIS:2h) length 1 data[0] num node 00h 5 01h n 00h Id_display_data (CRIS:3h) 5 01h 02h 00h 20h 40h 2 00h 80h C0h FFh 00h 01h 05h Id_write_command (CRIS:4h) 3 01h 06h 1Ch 1Dh 1Eh 1Fh 20h 3 2 03h 4 01h address 02h 00h 00h value value Write value in EB Write BTC_1 Write BTC_2 Write BTC_3 Write NNB Write CRIS Write value in Fuse (HWB) Start Application with Hardware Reset Start Application by LJMP address Erase block3 (32k to 48k) Erase block4 (48k to64k) Full chip Erase Write value in BSB Write value in SBV Write value in SSB start_address end_address data[0:8] start_address end_address Init EEPROM programming Data to program Display Flash Data Blank Check in Flash Display EEPROM Data Erase block0 (0k to 8k) Erase block1 (8k to 16k) Erase block2 (16k to 32k) data[1] data[2] data[3] data[4] Description Open / Close communication Init Flash programming
27
4251A-CAN-08/03
Table 1. Summary of Frames from Host (Continued)
Identifier length data[0] data[1] 00h 2 00h 01h 02h 00h 01h 05h 06h 30h Id_read_command (CRIS:5h) 2 01h 31h 60h 61h 1Ch 1Dh 1Eh 1Fh 20h 2 02h 00h data[2] data[3] data[4] Description Read Bootloader Version Read Device ID1 Read Device ID2 Read BSB Read SBV Read SSB Read EB Read Manufacturer Code Read Family Code Read Product Name Read Product Revision Read BTC_1 Read BTC_2 Read BTC_3 Read NNB Read CRIS Read HSB
Table 2. Summary of Frames from Target (Bootloader)
Identifier Id_select_node (CRIS:0h) Id_prog_start (CIRS:1h) length 2 data[0] Boot version data[1] 00h 01h data[2] n data (n = 0 to 8) data[3] data[4] Description communication close communication open Command ok Command ok Command fail Command New Data Data read Blank Check ok Blank Check fail Command ok
0
00h
Id_prog_data (CRIS:2h)
1
01h 02h
n Id_display_data (CRIS:3h) 0 2 Id_write_command (CIRS:4h) Id_read_command (CRIS:5h) 1
first address not blank 00h -
1
Value
-
-
-
Read Value
28
AT89C51CC03 CAN Bootloader
4251A-CAN-08/03
AT89C51CC03 CAN Bootloader
Table 2. Summary of Frames from Target (Bootloader) (Continued)
Identifier Id_error (CRIS:6h) length 1 data[0] 00h data[1] data[2] data[3] data[4] Description Software Security Error
29
4251A-CAN-08/03
Appendix-2
Table 3. API Summary
Function Name __api_rd_code_byte __api_wr_code_byte __api_wr_code_page __api_erase block0 __api_erase block1 __api_erase block2 __api_erase block3 __api_erase block4 __api_rd_HSB __api_clr_BLJB __api_set_BLJB __api_clr_X2 __api_set_X2 __api_rd_BSB __api_wr_BSB __api_rd_SBV __api_wr_SBV __api_erase_SBV __api_rd_SSB __api_wr_SSB __api_rd_EB __api_wr_EB __api_rd_CANBTC1 __api_wr_CANBTC1 __api_rd_CANBTC2 __api_wr_CANBTC2 __api_rd_CANBTC3 __api_wr_CANBTC3 __api_rd_NNB __api_wr_NNB __api_rd_CRIS __api_wr_CRIS Bootloader Execution no yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes yes 0Dh 0Dh 00h 00h 00h 00h 00h 08h 07h 07h 07h 07h 05h 04h 05h 04h 04h 05h 04h 05h 04h 05h 04h 05h 04h 05h 04h 05h 04h 05h 04h 00h 20h 40h 80h C0h 00h 00h 00h 01h 01h 01h 05h 05h 06h 06h 1Ch 1Ch 1Dh 1Dh 1Eh 1Eh 1Fh 1Fh 20h 20h return value (HSB & BFh) | 40h HSB & BFh (HSB & 7Fh) | 80h HSB & 7Fh return value value return value value FFh return value value return value value return value value return value value return value value return value value return value value api_command api_dph api_dpl api_value
30
AT89C51CC03 CAN Bootloader
4251A-CAN-08/03
AT89C51CC03 CAN Bootloader
Table 3. API Summary
Function Name __api_rd_manufacturer __api_rd_device_id1 __api_rd_device_id2 __api_rd_device_id3 __api_rd_bootloader_version __api_eeprom_busy __api_rd_eeprom_byte __api_wr_eeprom_byte __api_start_bootloader __api_start_isp Bootloader Execution yes yes yes yes yes no no no no no api_command 05h 05h 05h 05h 0Eh api_dph api_dpl 30h 31h 60h 61h 00h api_value return value return value return value return value return value -
31
4251A-CAN-08/03
Atmel Corporation
2325 Orchard Parkway San Jose, CA 95131 Tel: 1(408) 441-0311 Fax: 1(408) 487-2600
Atmel Operations
Memory
2325 Orchard Parkway San Jose, CA 95131 Tel: 1(408) 441-0311 Fax: 1(408) 436-4314
RF/Automotive
Theresienstrasse 2 Postfach 3535 74025 Heilbronn, Germany Tel: (49) 71-31-67-0 Fax: (49) 71-31-67-2340 1150 East Cheyenne Mtn. Blvd. Colorado Springs, CO 80906 Tel: 1(719) 576-3300 Fax: 1(719) 540-1759
Regional Headquarters
Europe
Atmel Sarl Route des Arsenaux 41 Case Postale 80 CH-1705 Fribourg Switzerland Tel: (41) 26-426-5555 Fax: (41) 26-426-5500
Microcontrollers
2325 Orchard Parkway San Jose, CA 95131 Tel: 1(408) 441-0311 Fax: 1(408) 436-4314 La Chantrerie BP 70602 44306 Nantes Cedex 3, France Tel: (33) 2-40-18-18-18 Fax: (33) 2-40-18-19-60
Biometrics/Imaging/Hi-Rel MPU/ High Speed Converters/RF Datacom
Avenue de Rochepleine BP 123 38521 Saint-Egreve Cedex, France Tel: (33) 4-76-58-30-00 Fax: (33) 4-76-58-34-80
Asia
Room 1219 Chinachem Golden Plaza 77 Mody Road Tsimshatsui East Kowloon Hong Kong Tel: (852) 2721-9778 Fax: (852) 2722-1369
ASIC/ASSP/Smart Cards
Zone Industrielle 13106 Rousset Cedex, France Tel: (33) 4-42-53-60-00 Fax: (33) 4-42-53-60-01 1150 East Cheyenne Mtn. Blvd. Colorado Springs, CO 80906 Tel: 1(719) 576-3300 Fax: 1(719) 540-1759 Scottish Enterprise Technology Park Maxwell Building East Kilbride G75 0QR, Scotland Tel: (44) 1355-803-000 Fax: (44) 1355-242-743
Japan
9F, Tonetsu Shinkawa Bldg. 1-24-8 Shinkawa Chuo-ku, Tokyo 104-0033 Japan Tel: (81) 3-3523-3551 Fax: (81) 3-3523-7581
e-mail
literature@atmel.com
Web Site
http://www.atmel.com
Disclaimer: Atmel Corporation makes no warranty for the use of its products, other than those expressly contained in the Company's standard warranty which is detailed in Atmel's Terms and Conditions located on the Company's web site. The Company assumes no responsibility for any errors which may appear in this document, reserves the right to change devices or specifications detailed herein at any time without notice, and does not make any commitment to update the information contained herein. No licenses to patents or other intellectual property of Atmel are granted by the Company in connection with the sale of Atmel products, expressly or by implication. Atmel's products are not authorized for use as critical components in life support devices or systems. (c) Atmel Corporation 2003. All rights reserved. Atmel (R) and combinations thereof are the registered trademarks of Atmel Corporation or its subsidiaries. Other terms and product names may be the trademarks of others.
Printed on recycled paper.
4251A-CAN-08/03 /xM


▲Up To Search▲   

 
Price & Availability of AT89C51CC0303

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X